home *** CD-ROM | disk | FTP | other *** search
- /***[f*****************************************************************
- * CITEXT.H -- PageMaker Text Interface.
- *
- * Copyright 1996 (c) Adobe Systems, Inc. All Rights Reserved
- *
- *
- ***f]*****************************************************************/
-
- #ifndef __CITEXT_H
- #define __CITEXT_H
-
- #include "pmtypes.h"
- #include "CIObjectAccess.h"
-
- // Information about the contents of
- // a PageMaker text hole object.
- //
- typedef struct _PMTextBlockInfo {
- unsigned short bNeedsComposing;
- unsigned long startCharNum; // relative to whole story
- unsigned long startLineNum; // relative to whole story
- unsigned short numChars; // num chars in text block
- unsigned short numLines; // num lines in text block
- unsigned long storyID;
- unsigned long indexInStory; // order of text block in series
- // of story's text blocks. First
- // text block is index 1.
- unsigned long prevBlockID; // ID of text block before this one
- unsigned long nextBlockID; // ID of text block following this one
- // To get the given text block's ID, use
- // CIObjectAccess::GetObjID().
- } PMTextBlockInfo;
-
- // Information about a line (including linebreak)
- //
- typedef enum _PMLineBreakType {
- PMLB_AutoWrapIntrusion, // autowrap intrusion
- PMLB_Overset, // text is overset
- PMLB_Hard, // hard line end (end of para.)
- PMLB_Tab, // break caused by tab
- PMLB_Force // forced line end (no para. end)
- } PMLineBreakType;
-
- typedef struct _PMLineInfo {
- unsigned long nCharCount;
- PMLineBreakType cLineBreakType;
- unsigned long nLineHeight;
- unsigned long nComposeWidth;
- unsigned long nLineNumber;
- unsigned long endwithdischy : 1; // lbrk ends with dischyish char
- unsigned long kernpairsexist : 1; // pairkerning applied to lbrk
- unsigned long letterspacing : 1; // set if lbrk was letterspaced
- unsigned long funnyhyphenation: 1;// for German, Swiss...
- unsigned long endwithladder : 1; // T = ends with ladder-rung char
- unsigned long needscomposing : 1;// Set if line needs composing.
- unsigned long badwidth : 1; // text is loose or tight
- unsigned long badkeep : 1; // pagination broke a keep rule
- unsigned long graphic : 1; // T = lbrk has in-line graphic
- } PMLineInfo;
-
- // Information about a story
- //
- typedef struct _PMStoryInfo {
- unsigned long nNumChars;
- unsigned long nNumLines;
- unsigned long nNumTxtBlock;
- unsigned long firstBlockID; // ID of first text block before this one
- } PMStoryInfo;
-
- #define PMFACENAMESIZE 64
- #define PMCOLORNAMESIZE 32
- #define PMSTYLENAMESIZE 32
-
- //-----------------------------------------------------------
- // Character Format Information
- typedef struct _PMCharFormatInfo {
- unsigned long nNumChars; // number of chars in the text run
- unsigned long nOffset; // char offset relative to the current
- // text run (based on the targetCharOffset
- // (which is relative to the entire story).
- char faceName[PMFACENAMESIZE]; // face name
- unsigned short size; // font size in tenth points
- // (float fsize=size/10);
- short leading; // font leading in tenth points
- // (float fleading=leading/10)
- // -1 means auto leading
- char colorName[PMCOLORNAMESIZE];// font color name
- // style bits (bold, italic, etc.)
- unsigned long plain : 1; // none of the others
- unsigned long bold : 1; // bold
- unsigned long italic : 1; // italic
- unsigned long underline : 1; // underlined
- unsigned long outline : 1; // outline chars
- unsigned long shadow : 1; // drop shadow
- unsigned long condense : 1; // narrow chars
- unsigned long extend : 1; // wide chars
- unsigned long hidden : 1; // hidden text
- unsigned long strickout : 1; // struck-through
- unsigned long superscript : 1; // superscripted
- unsigned long subscript : 1; // subscripted
- unsigned long allcaps : 1; // all caps
- unsigned long smallcaps : 1; // small caps
- unsigned long reverse : 1; // reverse
- short setwidth; // set pointsize (tenth points),
- // or -1 for square
- // tracking
- unsigned short notrack : 1;
- unsigned short verytight : 1;
- unsigned short tight : 1;
- unsigned short normal : 1;
- unsigned short loose : 1;
- unsigned short veryloose : 1;
- // general character info
- unsigned short isinline : 1; // is inline graphics
- unsigned short nobreak : 1; // 1 if no breaks allowed in this run
- short kernamt; // manual kern adjustment, in 1/1000th of em
- unsigned short smcapsize; // smallcap size, tenths of % of orig. font height
- unsigned short supersubsize; // sub/superscript size, tenths of % of font height
- unsigned short subscriptpos; // subscript pos, tenths of % of font height
- unsigned short superscriptpos; // superscript pos, tenths of % of font height
- short baselineshift; // baseline shift in signed twips
- unsigned short objTintAmt; // object-level tint value for the CFmt, 0=0%, 100=100%
- } PMCharFormatInfo;
-
-
- //-----------------------------------------------------------
- // Paragraph Format Information
- typedef enum _PMParaAlign {
- PMPara_Left = 0, // left justified (ragged right)
- PMPara_Right = 1, // right justified (ragged left)
- PMPara_Center = 2, // centered (ragged left and right)
- PMPara_Justify = 3, // justified (no ragged)
- PMPara_ForceJustify = 4 // force justified (justify all lines)
- } PMParaAlign;
-
- typedef enum _PMHyphLevel {
- PMHyph_Off=0,
- PMHyph_Fair=1,
- PMHyph_Good=2,
- PMHyph_Best=3,
- PMHyph_Manual=4
- } PMHyphLevel;
-
- typedef enum _PMLeadMethod {
- PMLead_None=0,
- PMLead_Proportional=1,
- PMLead_TopOfCaps=2,
- PMLead_Baseline=3
- } PMLeadMethod;
-
- typedef enum _PMLineStyle {
- PMLine_Solid=0,
- PMLine_ThinThin=1,
- PMLine_ThickThin=2,
- PMLine_ThinThick=3,
- PMLine_ThinThickThin=4,
- PMLine_ThinDash=5,
- PMLine_Squares = 6,
- PMLine_Dots = 7,
- PMLine_None = 8
- } PMLineStyle;
-
- /* Structures within the PMParaFormatInfo,
- * Note that 'gridit' (in flags) really applies to the line rather
- * than any individual rule. The value of gridit should be the same
- * for both above and below.
- */
- typedef struct _PMParaRule {
- unsigned short ruleExists : 1; // this rule exists/valid
- unsigned short useTextWidth : 1;// TRUE - text width, F = column width
- unsigned short gridIt : 1; // TRUE - adjust line break depth for grid
- unsigned short transparent : 1; // TRUE if transparent, opaque otherwise.
- PMLineStyle lineStyle; // line style
- unsigned short lineWeight; // line weight in points (scaled by 10)
- char colorName[PMCOLORNAMESIZE];// color name
- unsigned short objTintAmt; // Object-level tint
- short leftOffset; // offset from margin to left edge of rule
- short rightOffset; // offset from margin to right edge of rule
- short height; // distance from text baseline to top/bot
-
- } PMParaRule;
-
- typedef struct _PMParaFormatInfo {
- unsigned long nNumChars; // number of chars in the text run
- unsigned long nOffset; // char offset relative to the current
- // text run (based on the targetCharOffset
- // (which is relative to the entire story).
- char styleName[PMSTYLENAMESIZE]; // style name
- PMParaAlign align;
- PMHyphLevel hyphenLevel;// hyphenation level
- PMLeadMethod leadMethod; // leading method
- char languageName[64];
- unsigned short includeTOC : 1; // 1 to include table of content, 0 otherwise
- unsigned short pairkern : 1; // 1 is on, 0 is off
- short indleft; // left indent in twips
- short indfirst; // first line of paragraph indent in twips
- short indright; // right indent in twips
- short spbefore; // extra space before paragraph in twips
- short spafter; // extra space after paragraph in twips
- unsigned short kernsize; // size above which we must kern (scale by 10)
- // real kern size is: float realsize = kernsize/10
- short leadpct; // Autolead percentage.
- short minband; // minimum spaceband width
- short maxband; // maximum spaceband width
- short desband; // desired spaceband width
- short minltrsp; // minimum letterspacing
- short maxltrsp; // maximum letterspacing
- short desltrsp; // desired letterspacing
- short hotzone; // hot zone width for ragged hyphenation in twips
- unsigned short maxhyphens; // max consecutive hyphens allowed
- // for keeps/breaks...
- unsigned short keepTogether:1;
- unsigned short keepColumnBreak:1;
- unsigned short keepPageBreak:1;
- unsigned short keepFollow:2;
- unsigned short keepWidow:2;
- unsigned short keepOrphan:2;
- unsigned short usegrid; // leading for para's grid (twips), or NO_GRID
- PMParaRule ruleAbove; // rule above info
- PMParaRule ruleBelow; // rule below info
- } PMParaFormatInfo;
-
- //-----------------------------------------------------------
- // Tab Format Information
- #define MAXTABS 40 // maximum number of tabs
-
- typedef enum _PMTabAlign {
- PMTab_Left=0,
- PMTab_Right=1,
- PMTab_Center=2,
- PMTab_Decimal=3
- } PMTabAlign;
-
- typedef struct _PMTabStop {
- short pos; // in Twips
- PMTabAlign align; // tab alignment
- char leaderPair[2]; // tab leader pair
- } PMTabStop;
-
- typedef struct _PMTabFormatInfo {
- unsigned long nNumChars; // number of chars in the text run
- unsigned long nOffset; // char offset relative to the current
- // text run (based on the targetCharOffset
- // (which is relative to the entire story).
- unsigned long nNumTabs; // number of tabs in tabStop
- PMTabStop tabStop[MAXTABS];
- } PMTabFormatInfo;
- //-----------------------------------------------------------
-
- #ifdef __cplusplus
-
- class CIText : public CIInterface
- {
- public:
- virtual ~CIText() {};
-
- // Return text hole information for the given object
- virtual PMErr GetTextBlockInfo(PMOBJ_REC* pObjRec, PMTextBlockInfo* pTextBlockInfo) = 0;
- // Return line information for the given story and line number
- virtual PMErr GetTextLineBreakInfo(unsigned long storyID, unsigned long lineNumber, PMLineInfo* pLineBreakInfo) = 0;
- // Return information for the given story
- virtual PMErr GetTextStoryInfo(unsigned long storyID, PMStoryInfo* pStoryInfo) = 0;
- // Return the first inline graphic found in the given
- // story's list of ILGs
- // This returns all inline graphics--both "valid" and "invalid" ones.
- // "Invalid" inlines are those that have not been drawn since they were
- // moved or possibly moved or will have been moved by composition.
- virtual PMErr GetStoryFirstILG(unsigned long storyID, PMOBJ_REC* pILGObjRec) = 0;
- // Return the next inline graphic found in the given
- // story's list of ILGs
- virtual PMErr GetStoryNextILG(PMOBJ_REC* pILGObjRec) = 0;
- // ReadStoryTextRaw
- // Given a story ID and a text range (offset & numChars),
- // return a pointer buffer of raw text in ppTextBuf and
- // the size of the buffer in buffer size.
- // The offset parameter specifies the character offset
- // into the given story. Use an offset of 0 to start
- // at the beginning of the story.
- // The nFormat parameter is used as follows:
- // 0 to keep all non-printing characters
- // 1 to delete all non-printing characters
- // 2 to replace all non-printing characters with spaces
- // 3 to substitute all non-printing ASCII characters as
- // text export filter does
- //
- // IMPORTANT NOTES:
- // ReadStoryTextRaw() will allocate the memory for the text.
- // When done with the buffer, the plug-in must call FreeTextMemory()!!!
- // Any calls to any of the ReadStoryTextXXX() methods will
- // automatically free any previously allocated memory!
- virtual PMErr ReadStoryTextRaw(unsigned long storyID, unsigned short nFormat,
- unsigned long offset, unsigned long numChars,
- char** ppTextBuf, unsigned long* bufSize) = 0;
- // ReadStoryTextTagged
- // Given a story ID and a text range (offset & numChars),
- // return a pointer buffer of tagged text in ppTextBuf and
- // the size of the buffer in buffer size.
- // The offset parameter specifies the character offset
- // into the given story. Use an offset of 0 to start
- // at the beginning of the story.
- // The nFormat parameter is used as follows:
- // 0 to keep all non-printing characters
- // 1 to delete all non-printing characters
- // 2 to replace all non-printing characters with spaces
- // 3 to substitute all non-printing ASCII characters as
- // text export filter does
- //
- // IMPORTANT NOTES:
- // ReadStoryTextTagged() will allocate the memory for the text.
- // When done with the buffer, the plug-in must call FreeTextMemory()!!!
- // Any calls to any of the ReadStoryTextXXX() methods will
- // automatically free any previously allocated memory!
- virtual PMErr ReadStoryTextTagged(unsigned long storyID, unsigned short nFormat,
- unsigned long offset, unsigned long numChars,
- char** ppTextBuf, unsigned long* bufSize) = 0;
- // ReadStoryTextRTF
- // Given a story ID and a text range (offset & numChars),
- // return a pointer buffer of RTF text in ppTextBuf and
- // the size of the buffer in buffer size.
- // The offset parameter specifies the character offset
- // into the given story. Use an offset of 0 to start
- // at the beginning of the story.
- // The nFormat parameter is ignored by ReadStoryTextRTF.
- //
- // IMPORTANT NOTES:
- // ReadStoryTextRTF() will allocate the memory for the text.
- // When done with the buffer, the plug-in must call FreeTextMemory()!!!
- // Any calls to any of the ReadStoryTextXXX() methods will
- // automatically free any previously allocated memory!
- virtual PMErr ReadStoryTextRTF(unsigned long storyID, unsigned short nFormat,
- unsigned long offset, unsigned long numChars,
- char** ppTextBuf, unsigned long* bufSize) = 0;
- // FreeTextMemory
- // Frees any text buffer allocated by one of the
- // ReadStoryTextXXX() methods.
- virtual void FreeTextMemory() = 0;
-
- virtual PMErr GetTextSelection(unsigned long *pBlockID, unsigned long *pStoryID,
- unsigned long *pOffset, unsigned long *pNumChars ) = 0;
-
- // RecomposeAllStories is called when every story in the pub needs to be recomposed.
- // Some text attributes are pub level, hence changing them requires recomposing
- // everything
- virtual void RecomposeAllStories()=0;
-
- // Setup the inlines in the current story. Only operates on current page.
- virtual void SetupStoryInlines()=0;
-
- // RecomposeStory compose all stories on current page or to end of pub
- // bEndofPub is FALSE, this function will compose all stories on
- // the current page that need recomposing, starting from the 1st
- // hole in the story through the last hole of the story on the page.
- // bEndofPub is TRUE, this will compose each story to the end of the pub
- virtual void RecomposeStory(BOOL bEndofPub)=0;
-
- virtual PMErr GetCharFormatInfo(unsigned long storyID, long targetCharOffset,
- PMCharFormatInfo *pCharFormatInfo)=0;
-
- virtual PMErr GetParaFormatInfo(unsigned long storyID, long targetCharOffset,
- PMParaFormatInfo *pParaFormatInfo)=0;
-
- virtual PMErr GetTabFormatInfo(unsigned long storyID, long targetCharOffset,
- PMTabFormatInfo *pTabFormatInfo)=0;
-
- virtual PMErr GetLineBreakInfo(unsigned long storyID, long targetCharOffset,
- PMLineInfo *pLineInfo)=0;
-
- virtual PMErr GetStyleNameInfo(char *pStyleName, PMTabFormatInfo *pTabFormatInfo,
- PMParaFormatInfo *pParaFormatInfo,
- PMCharFormatInfo *pCharFormatInfo)=0;
- } ;
-
- #endif // __cplusplus
-
- #endif
-